ArrayMap vs HashMap

HashMap

Java 8 对接口做了进一步的增强。

a. 在接口中可以添加使用 default 关键字修饰的非抽象方法。即:默认方法(或扩展方法)

b. 接口里可以声明静态方法,并且可以实现。

1
2
3
4
5
6
7
8
public interface TTT {
static void test(){
System.out.println("hhhh");
}
default void sayHi() {
System.out.println("hhh");
}
}